package main

import (
	"context"
	"zsc-boot/app/customer"
	"zsc-boot/app/message"
	"zsc-boot/app/system_layer"
	"zsc-boot/core"
	"zsc-boot/core/rpc"
	"zsc-boot/core/utils"
	"zsc-boot/core/web"
)

func main() {
	system_layer.Init()
	message.Init()
	customer.Init()

	core.StartCron()
	defer ginServer()

}

func ginServer() {
	go web.Run()
	utils.Shutdown(func(ctx context.Context) error {
		return web.Srv.Shutdown(ctx)
	})
}

func grpcServer() {
	//启动grpc服务
	go rpc.Start()

	//优雅关机
	utils.Shutdown(func(ctx context.Context) error {
		rpc.GetGrpcServer().GracefulStop()
		return nil
	})
}
